﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using iLangl.Model;
using iLangl.Transport.Communication;
using iLangl.Customer.Managers;

namespace iLangl.Customer.Actions.Input
{
	public class SynchronizeAction : BaseCustomerAction
	{
				private SyncedOneWayData result = null;
				public SynchronizeAction()
			: base()
		{
			ResponseContext = new SyncedDataResponseContext();
			RequestContext = new ActionResultRequestContext();
		}

		protected override void _execute()
		{
			result = (SyncedOneWayData)ResponseContext.GetContext();


			if (result == null)
			{
				throw new ApplicationException("Synced Data Is Empty!");
			}


			SynchronizationManager.Instance.SyncData(result);

			ActionResult actionresult = new ActionResult();
			RequestContext.SetContext(actionresult);
		}

		protected override string GetName()
		{
			return "SyncedDataAction";
		}
	}
}
